package com.spring.controller;

import com.spring.pojo.Movie;
import com.spring.util.ApiUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;
import java.util.List;

@Controller
public class MovieController {
    @GetMapping("/movie")
    public String index(Model model) throws IOException {
        List<Movie> movies = ApiUtil.getPopularMovies();
        model.addAttribute("movies", movies);
        return "movie";
    }
}
